Don't register a GTK+ scrollbar click as a buffer click.
authorRob Browning <rlb@defaultvalue.org>
Wed, 27 Jan 2010 05:57:04 +0000 (21:57 -0800)
committerRob Browning <rlb@defaultvalue.org>
Wed, 27 Jan 2010 05:57:04 +0000 (21:57 -0800)
debian/changelog
debian/patches/fix-gtk-scroll-bar-events.diff [new file with mode: 0644]
debian/patches/series

index 9d3a00c03f1cbbdfa567e8e1ca3ad22a43950597..4d4507fdca6205054415b6f90719718dfca3606d 100644 (file)
@@ -1,3 +1,12 @@
+emacs23 (23.1+1-7) unstable; urgency=low
+
+  * Apply an upstream patch to fix a problem with GTK+ scroll
+    bars. Thanks to Eugen Dedu <Eugen.Dedu@pu-pm.univ-fcomte.fr> for
+    the report and Sven Joachim <svenjoac@gmx.de> for tracking down
+    the patch. (closes: #560573)
+
+ -- Rob Browning <rlb@defaultvalue.org>  Thu, 21 Jan 2010 21:51:45 -0800
+
 emacs23 (23.1+1-6) unstable; urgency=low
 
   * Fix update-alternatives call for emacs manpage.  Thanks to
diff --git a/debian/patches/fix-gtk-scroll-bar-events.diff b/debian/patches/fix-gtk-scroll-bar-events.diff
new file mode 100644 (file)
index 0000000..dc5a8cb
--- /dev/null
@@ -0,0 +1,115 @@
+* Emacs should no longer treat a click in a GTK+ scroll bar as a buffer click.
+  Patch: fix-gtk-scroll-bar-events.diff
+  Originally-reported-by: Eugen Dedu <Eugen.Dedu@pu-pm.univ-fcomte.fr>
+  Date: Fri, 11 Dec 2009 10:12:24 +0100
+  Added-by: Rob Browning <rlb@defaultvalue.org>
+  Status: incorporated upstream
+  Bug: 560573
+
+  The Debian patch is taken from this upstream commit:
+
+    From: Jan Djärv <jan.h.d@swipnet.se>
+    Date: Fri, 6 Nov 2009 08:30:43 +0000 (+0000)
+    Subject: Fix bug #4870, issues 3 and 4.
+    X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commitdiff_plain;h=05caf88f056600a89b434982df4bda33a532b995
+
+Index: b/src/ChangeLog
+===================================================================
+--- a/src/ChangeLog
++++ b/src/ChangeLog
+@@ -1,4 +1,13 @@
+ 2009-09-02  Jan Djärv  <jan.h.d@swipnet.se>
++2009-11-06  Jan Djärv  <jan.h.d@swipnet.se>
++
++      * gtkutil.c (xg_event_is_for_scrollbar): New function (bug#4870).
++
++      * gtkutil.h: Declare xg_event_is_for_scrollbar (bug#4870).
++
++      * xterm.c (handle_one_xevent): Call xg_event_is_for_scrollbar for
++      ButtonPressRelease and MotionNotify (bug#4870).
++
+       * xterm.h: Rename x_non_menubar_window_to_frame to
+       x_menubar_window_to_frame
+Index: b/src/gtkutil.c
+===================================================================
+--- a/src/gtkutil.c
++++ b/src/gtkutil.c
+@@ -3401,6 +3401,38 @@
+     }
+ }
++/* Return non-zero if EVENT is for a scroll bar in frame F.
++   When the same X window is used for several Gtk+ widgets, we cannot
++   say for sure based on the X window alone if an event is for the
++   frame.  This function does additional checks.
++
++   Return non-zero if the event is for a scroll bar, zero otherwise.  */
++
++int
++xg_event_is_for_scrollbar (f, event)
++     FRAME_PTR f;
++     XEvent *event;
++{
++  int retval = 0;
++
++  if (f && event->type == ButtonPress)
++    {
++      /* Check if press occurred outside the edit widget.  */
++      GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
++      retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL)
++        != f->output_data.x->edit_widget->window;
++    }
++  else if (f && (event->type != ButtonRelease || event->type != MotionNotify))
++    {
++      /* If we are releasing or moving the scroll bar, it has the grab.  */
++      retval = gtk_grab_get_current () != 0
++        && gtk_grab_get_current () != f->output_data.x->edit_widget;
++    }
++
++  return retval;
++}
++
++
\f
+ /***********************************************************************
+                       Tool bar functions
+Index: b/src/gtkutil.h
+===================================================================
+--- a/src/gtkutil.h
++++ b/src/gtkutil.h
+@@ -179,7 +179,7 @@
+                                                  int portion,
+                                                  int position,
+                                                  int whole));
+-
++extern int xg_event_is_for_scrollbar P_ ((FRAME_PTR f, XEvent *event));
+ extern void update_frame_tool_bar P_ ((FRAME_PTR f));
+ extern void free_frame_tool_bar P_ ((FRAME_PTR f));
+Index: b/src/xterm.c
+===================================================================
+--- a/src/xterm.c
++++ b/src/xterm.c
+@@ -6749,6 +6749,10 @@
+             clear_mouse_face (dpyinfo);
+           }
++#ifdef USE_GTK
++        if (f && xg_event_is_for_scrollbar (f, &event))
++          f = 0;
++#endif
+         if (f)
+           {
+@@ -6905,6 +6909,10 @@
+         else
+           f = x_window_to_frame (dpyinfo, event.xbutton.window);
++#ifdef USE_GTK
++        if (f && xg_event_is_for_scrollbar (f, &event))
++          f = 0;
++#endif
+         if (f)
+           {
+             /* Is this in the tool-bar?  */
index 3db6e98787fc2c41ae8d1a02b8f90b4334042745..0923459622a2f392f2a26f49e29756313468fdaf 100644 (file)
@@ -10,4 +10,5 @@ look-for-news-to-find-etc.diff
 fix-flymake-xmlstarlet-invocation.diff
 fix-rmail-capitalized-month-names.diff
 fix-dynamic-menus.diff
+fix-gtk-scroll-bar-events.diff
 autofiles.diff